<?php
namespace app\index\controller;
use \think\Controller as view;
use app\index\model\User;
class Index extends view
{
    public function index()
    {
        return '<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }</style><div style="padding: 24px 48px;"> <h1>:) </h1><p> ThinkPHP V5.1<br/><span style="font-size:30px">12载初心不改（2006-2018） - 你值得信赖的PHP框架</span></p></div><script type="text/javascript" src="https://tajs.qq.com/stats?sId=64890268" charset="UTF-8"></script><script type="text/javascript" src="https://e.topthink.com/Public/static/client.js"></script><think id="eab4b9f840753f8e7"></think>';
    }

    public function hello($name = 'ThinkPHP5')
    {
        return 'hello,' . $name;
    }

    public function num($num)
    {
       // return 'hello,num:' . $num;
        $all = [
            'num'=>$num,
            'hh' => 1,
            'ee' => 2,
        ];
        return $this->fetch('hello',$all);
    }

    public function bind($id){
        echo "<pre>";
        echo "当前函数名:".__FUNCTION__.PHP_EOL;
        echo "当前方法名:".__METHOD__.PHP_EOL;
        var_dump(\Request::param());die();
    }

    /**
     *
     */
    public function user(){

        $user = new User();
        $data = array(
            'user_name' => 'username',
            'nick_name' => 'nickname',
            'phone' => '18659209394',
        );
        $user -> save($data);

        /*$download =  new \think\response\Download('/mnt/hgfs/tp5/thinkphp/library/think/response/Xml.php');
        return $download->name('my.jpg');
        // 或者使用助手函数完成相同的功能
        // download是系统封装的一个助手函数
        return download('image.jpg', 'my.jpg');

        return redirect('http://www.thinkphp.cn');*/
        //$list = User::where('id','>',0)->select();
        //json()->data($list);
       // return json()->data($list);
       //return response()->data($list);
        //json()->data($list);
        //response()->data($list);
       //var_dump($list);

    }


}
